package com.jlpay.openapi.demo.base;

import com.jlpay.open.jlpay.sdk.java.model.base.request.ListRegionRequest;
import com.jlpay.open.jlpay.sdk.java.model.base.response.ListRegionResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author zhangyongfeng
 * @date 2025/7/21
 */
public class ListRegionService {

    private static final Logger LOGGER = LoggerFactory.getLogger(ListRegionService.class);

    public static void main(String[] args) {
        ListRegionRequest request = buildRequest();
        ListRegionResponse response = JlpayOpenApiService.openMerchService()
                .post(request, ListRegionResponse.class);

        LOGGER.info("地区码查询响应:{}", JsonUtils.toString(response));
    }

    private static ListRegionRequest buildRequest() {
        ListRegionRequest request = new ListRegionRequest();
        request.setRegionName("南山");
        request.setRegionCode("440305");
        request.setParentCode("440300");
        request.setRegionRank(3);
        request.setLimit(10);
        request.setOffset(0);
        return request;
    }
}
